<?php
/*
 * Created on 03.01.2006
 *
 */

/**
 * Checks xics permissions
 */
class xbt_ifpermHandler 
{

    function startElement (& $sender, $attrs, $line)
    {
        if (!isset($attrs['id']))
        {
            die ("Attribute id is missing in xbt:ifperm tag in line $line\n");
        }
        if (!isset($attrs['perm']))
        {
            die ("Attribute perm is missing in xbt:ifperm tag in line $line\n");
        }
        $sender->appendCode('$__usr = &$env->getAttribute("__usr"); if ($__usr->checkPermission('.$attrs['id'].', '.$attrs['perm'].')):'."\n");
    }
    
    function endElement (& $sender)
    {
        $sender->appendCode('endif;'."\n");    
    }

}

?>
